<script>
import { usePrint } from "./composables/print.js";
const { setPlatform } = usePrint();
export default {
  onLaunch: function () {
    const updateManager = uni.getUpdateManager();

    updateManager.onCheckForUpdate(function (res) {
      // 请求完新版本信息的回调
      console.log(res.hasUpdate);
    });

    updateManager.onUpdateReady(function (res) {
      uni.showModal({
        title: "更新提示",
        content: "新版本已经准备好，是否重启应用？",
        success(res) {
          if (res.confirm) {
            // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
            updateManager.applyUpdate();
          }
        },
      });
    });

    updateManager.onUpdateFailed(function (res) {
      // 新的版本下载失败
    });
    uni.getSystemInfo({
      success: function (res) {
        res.hostName = res.hostName.toLowerCase();
        console.log("res.hostName", res.hostName);
        switch (res.hostName) {
          case "wechat":
          case "wxwork":
            setPlatform("微信");
            break;
          case "dingtalk":
            setPlatform("钉钉");
            console.log("钉钉11111111111");
            break;
          case "feishu":
            setPlatform("飞书");
            break;
          default:
            console.log("未识别的平台");
        }
      },
    });
  },
  onShow: function () {},
  onHide: function () {},
};
</script>



<style lang="scss">
@import "@/static/scss/index.scss";
@import "uview-plus/index.scss";
</style>
